package com.arykow.engine.onwebapp.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Hyperlink;
import com.google.gwt.user.client.ui.Widget;

public class FeedsContainerElement extends Composite {

	private static FeedsContainerElementUiBinder uiBinder = GWT.create(FeedsContainerElementUiBinder.class);

	interface FeedsContainerElementUiBinder extends UiBinder<Widget, FeedsContainerElement> {
	}

	public FeedsContainerElement() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	@UiField
	Hyperlink hyperlink;

	public FeedsContainerElement(Feed feed) {
		this();
		updateComponent(feed);
	}

	public void updateComponent(Feed feed) {
		hyperlink.setTargetHistoryToken("feed/" + feed.getId());
		hyperlink.setText(feed.getTitle());
	}
}
